<template>
  <section class="section">
    <h2 class="section-title">技术教程</h2>
    <div class="tutorials-grid">
      <article class="tutorial-card">
        <img src="https://images.pexels.com/photos/34225001/pexels-photo-34225001.jpeg?auto=compress&cs=tinysrgb&h=200" alt="Vue3实战教程" class="card-img" @error="handleImageError">
        <div class="card-content">
          <h3>Vue3实战教程</h3>
          <p class="tutorial-meta">发布于 2023年6月15日 | 阅读时长: 15分钟</p>
          <p class="tutorial-desc">深入浅出地讲解Vue3的核心概念和实际应用，包括Composition API、响应式系统和性能优化技巧。</p>
        </div>
      </article>
      <article class="tutorial-card">
        <img src="https://images.pexels.com/photos/34225003/pexels-photo-34225003.jpeg?auto=compress&cs=tinysrgb&h=200" alt="微服务架构设计" class="card-img" @error="handleImageError">
        <div class="card-content">
          <h3>微服务架构设计</h3>
          <p class="tutorial-meta">发布于 2023年5月22日 | 阅读时长: 22分钟</p>
          <p class="tutorial-desc">详细介绍微服务架构的设计原则、拆分策略和服务间通信机制，结合实际案例进行分析。</p>
        </div>
      </article>
      <article class="tutorial-card">
        <img src="https://images.pexels.com/photos/34212988/pexels-photo-34212988.jpeg?auto=compress&cs=tinysrgb&h=200" alt="Docker容器化部署" class="card-img" @error="handleImageError">
        <div class="card-content">
          <h3>Docker容器化部署</h3>
          <p class="tutorial-meta">发布于 2023年4月10日 | 阅读时长: 18分钟</p>
          <p class="tutorial-desc">从基础概念到实际操作，全面介绍如何使用Docker进行应用容器化和集群部署。</p>
        </div>
      </article>
    </div>
  </section>
</template>

<script setup>
// 技术教程页面
const handleImageError = (event) => {
  event.target.src = 'https://images.pexels.com/photos/3184454/pexels-photo-3184454.jpeg?auto=compress&cs=tinysrgb&h=200'
}
</script>

<style scoped>
.tutorials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
}

.tutorial-card {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  transition: transform 0.3s, box-shadow 0.3s;
}

.tutorial-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.card-content {
  padding: 1.5rem;
}

.card-content h3 {
  margin-bottom: 0.5rem;
  color: #2c3e50;
}

.tutorial-meta {
  color: #3498db;
  font-weight: 500;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.tutorial-desc {
  color: #666;
  line-height: 1.6;
}
</style>